<template>
  <div>
    <div class="mui-numbox" data-numbox-step='1' data-numbox-min='1' >
      <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
      <input class="mui-numbox-input" type="number" ref="num" @change="countchange" />
      <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
    </div>
  </div>
</template>

<script>
import mui from '../../lib/mui/js/mui.min.js'
export default {
  mounted(){
    // 初始化数字择框组件
    mui(".mui-numbox").numbox()
  },
  methods:{
    countchange(){
    // console.log(this.$refs.num.value)
    this.$emit("getcount",parseInt(this.$refs.num.value))
  }
  },
  props:["max"],
  watch:{
    "max":function(newval){
      mui(".mui-numbox").numbox().setOption("max",newval)
    }
  }
}
</script>

<style lang="less" scoped>

</style>